package cn.hdu.liang.io;

import java.io.*;

public class StoringAndRecoveringData {
    public static void main(String[] args) throws IOException {

        DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
                new FileOutputStream(PATH.OUT + "Data.txt")));

        out.writeDouble(3.1415926);
        out.writeUTF("试试中文");
        out.writeDouble(1.41413);
        out.writeUTF("中文应该没问题");
        out.close();

        DataInputStream in = new DataInputStream(new BufferedInputStream(
                new FileInputStream(PATH.OUT + "Data.txt")));

        System.out.println(in.readDouble());
        System.out.println(in.readUTF());
        System.out.println(in.readDouble());
        System.out.println(in.readUTF());

        in.close();
    }
}
